<link href="<?php echo URL::base() ?>media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-1.10.2.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-1.10.4.custom.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script>

<style type="text/css">
		*{
			margin: 0px;
			padding: 0px;
			}
			.maxbox{
				width: 1000px;
				height:auto;
				margin: auto;
				}
			.upbox{
				height: 100px;
					}
			.downbox{
				width: 1000px;
				height: auto;
				}
.control-label { display:inline-block; width:120px; text-align:right; }
</style>
<script type="text/javascript">
$(document).ready(function(){
	$.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
							$("#date_from").datepicker({  
							    onSelect:function(dateText,inst){  
							       $("#date_to").datepicker("option","minDate",dateText);  
							    }  
							});  
							$("#date_to").datepicker({  
							    onSelect:function(dateText,inst){  
							        $("#date_from").datepicker("option","maxDate",dateText);  
							    }  
							});
		$("#date_from").val('<?php echo isset($date_from)?$date_from:""; ?>');
		$("#date_to").val('<?php echo isset($date_to)?$date_to:""; ?>');
		$("#supplier_id").val('<?php echo isset($supplier_id)?$supplier_id:""; ?>');
		$("#purchaseorder_id").val('<?php echo isset($purchaseorder_id)?$purchaseorder_id:""; ?>');
	});
function resetdata()
{
		$("#date_from").val('');
		$("#date_to").val('');
		$("#supplier_id").val('');
		$("#purchaseorder_id").val('');

}
	</script>
<script type="text/javascript">
$(document).ready(function(){
	$('.table1 > tbody > tr:odd').css("background-color","#f5f5f5");
})
</script>
<form action="<?php  echo URL::site() ?>purchases/paydetail?>" method="get">

<div class="control-group warning">
	
	<label class="control-label" for="inputWarning">采购单时间:</label>

	<input type="text" name='date_from' id="date_from" >     ~    
	<input type="text" name='date_to' id="date_to">

</div>
<div class="control-group warning">
	<label class="control-label" for="inputWarning">采购单号:</label>
	
	<input type="text" name="purchaseorder_id" id="purchaseorder_id" > 
	
</div>
<div class="control-group warning">
	<label class="control-label" for="inputWarning">供应商:</label>
	
	<input type="text" name="supplier_id" id="supplier_id" > 
	

</div>	
<div class="control-group warning" style=" margin-left: 124px;margin-top: 15px;">
	<button class="btn btn-info" type="submit">查询</button>
	<button class="btn btn-inverse" onclick="resetdata()" type="button">重置</button>
</div>

</form>


					<table class="table table1 table-hover" >
						<thead>
							<tr style=" background-color:#4EA392; color:#fff;">
								<th>
									付款明细单号
								</th>
								<th>
									采购单号
								</th>
								<th>
									供应商
								</th>
								<th>
									应付金额
								</th>
								<th>
									实付金额
								</th>
								<th>
									付款时间
								</th>
								<th>
									付款人
								</th>
							</tr>
						</thead>
						<?php if(isset($pay_detail)){?>
						<?php foreach($pay_detail as $pay1){?>
							<tbody>
							<tr id="select">
								<td>	
									<?php echo $pay1['id'];?>						
								</td>
								<td>	
									<?php echo $pay1['purchaseorder_id'];?>						
								</td>
								<td>	
									<?php echo Purchase::select_s_name($pay1['supplier_id']);?>					
								</td>
								<td>	
									<?php echo $pay1['amount_payable'];?>				
								</td>
								<td>	
									<?php echo $pay1['amount_paid'];?>			
								</td>
								<td>	
									<?php echo $pay1['pay_date'];?>						
								</td>
								<td>
									<?php echo ORM::factory('user',$pay1['payer'])->name;?>				
								</td>
							</tr>
							<?php }?>				
						<?php }?>
						</tbody>
	<?php if(isset($pagination)) echo $pagination;?>
			
					

					</table>

	<?php if(isset($pagination)) echo $pagination;?>


